<!DOCTYPE html>
<html>
    {% load static %}
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>

<!-- Bootstrap core CSS -->
<link href="{% static 'assets/css/bootstrap.css' %}" rel="stylesheet">
<!--external css-->
<link href="{% static 'assets/font-awesome/css/font-awesome.css' %}" rel="stylesheet" />
    
<!-- Custom styles for this template -->
<link href="{% static 'assets/css/style.css' %}" rel="stylesheet">
<link href="{% static 'assets/css/style-responsive.css' %}" rel="stylesheet">

<!-- js placed at the end of the document so the pages load faster -->
<script src="{% static 'assets/js/jquery.js' %}"></script>
<script src="{% static 'assets/js/bootstrap.min.js' %}"></script>
<script class="include" type="text/javascript" src="{% static 'assets/js/jquery.dcjqaccordion.2.7.js' %}"></script>
<script src="{% static 'assets/js/jquery.scrollTo.min.js' %}"></script>
<script src="{% static 'assets/js/jquery.nicescroll.js' %}" type="text/javascript"></script>


<!--common script for all pages-->
<script src="{% static 'assets/js/common-scripts.js' %}"></script>

<!--script for this page-->

<!-- 引入刚刚下载的 ECharts 文件 -->
<script src="{% static 'assets/js/echarts.js' %}"></script>
<script src="{% static 'assets/js/highlight.min.js' %}"></script>
    <script>
        hljs.highlightAll();
    </script>

    <script src="{% static 'assets/dist/notice.min.js' %}"></script>
    <script>
        const notice = new Notice();
    </script>

    <script src="{% static 'assets/js/main.js' %}"></script>
    <link rel="stylesheet" href="{% static 'assets/css/style.css' %}">
    <link rel="stylesheet" href="{% static 'assets/dist/notice.min.css' %}">
    <link rel="stylesheet" href="{% static 'assets/css/default.min.css' %}">
    <link href="{% static 'assets/css/the-datepicker.css' %}" rel="stylesheet">
   <script src="{% static 'assets/js/print.js' %}"></script>

    <script type="text/javascript">
    function toPrint() {
        Print('#form', {
        noPrint: '.noPrint'
        });
    }
    </script>
    <script>
       
    function re(){
        document.getElementById("fu").style.display="none";
                document.getElementById("yuan").style.display="";
    }
</script>
    {{context}}
    <body>
        <section id="main-content">
            <section class="wrapper">
                <h3><i class="fa fa-angle-right"></i> 查看发票收据
                </h3>
                
              <div class="row mt">  
                  <div class="col-lg-12">
                    <div class="col-lg-12">
                        <div class="pull-right">
                            <button type="button" class="btn btn-theme03" onclick="toPrint()"><i class="fa fa-print" aria-hidden="true"></i> 打印</button>
                          </div><br><br>
                          <div id='form'>
                      <div class="content-panel">
                        <h4 style="text-align:center">发票收据</h4>
                        <h5 style="text-align:center">供应商：{{context.vendor.vname}}</h4>
                        <section id="unseen">
                          <table class="table">
                              
                                  <tbody>
                                    <tr>
                                        <td  style="text-align:right;">
                                            <label>发票收据编号：</label>
                                            <label>{{context.id}}</label>
                                        </td>
                                        
                                    </tr>
                                    <tr>
                                       
                                        <td style="text-align:right;">
                                            <label>开票日期：</label>
                                            <label>{{context.invoice.invoiceDate}}</label>
                                        </td>
                                        
                                    </tr>
                                  
                                  
                      
                              </thead>
                  
                          </table>

                          
                          <div class="row mt">
                            <div class="col-md-12">
                              <div class="col-md-12">
                              <div class="content-panel">
                                  <!-- <div class="form-panel2"> -->
                                  <table class="table table-striped table-advance table-hover">
                                          {% comment %} <h4><i class="fa fa-angle-right"></i> 商品信息</h4> {% endcomment %}
                                      <thead>
                                      <tr>
                                          
                                          {% comment %} <th><i class="fa fa-question-circle"></i> 商品编码</th> {% endcomment %}
                                          <th> 商品名称</th>
                                          <th> 数量</th>
                                          <th> 单价</th><!--后面加上货币-->
                                          <th> 总价</th>
                                          <th> 备注</th>
                                      </tr>
                                      </thead>
                                      <tbody>
                                      <tr>
                                          <td>{{context.material.mname}}</td>
                                          <td>{{context.gr.actualQnty}}</td>
                                          <td>{{context.price}} {{context.currency}}</td>
                                          <td>{{context.invoice.sumAmount}} {{context.invoice.currency}}</td>
                                          <td>{{context.invoice.text}}</td>
                                          
                                      </tr>
                                    
                                      </tbody>
                                  </table>
                              </div>
                              </div>
                               
                                </div>
                            </div><!-- /col-md-12 -->

                            <table class="table">
                             
                                <tbody>
                                    <tr>
                                        <td>
                                            <label>过账时间：</label>
                                            <label>{{context.gr.postTime}}</label>
                                        </td>
                                        <td>
                                            <label>所属财年：</label>
                                            <label>{{context.invoice.fiscal}}</label>
                                        </td>
                                        
                                        <td>
                                            <label>支付类型：</label>
                                            <label>{{context.vendor.tpType}}</label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label>关联采购订单：</label>
                                            <label>{{context.gr.id}}</label>
                                        </td>
                                        
                                        <td>
                                            <label>关联条目：</label>
                                            <label>{{context.itemId}}</label>
                                        </td>
                                    </tr>
                                 
  
                                </tbody>
                            </table>
                            <table class="table">
                             
                                <tbody>
                                    <tr>
                                        <td>
                                            <label>编号: </label>
                                            <label>{{context.invoice.id}}</label>
                                        </td>
                                        <td>
                                            <label>地址：</label>
                                            <label>{{context.vendor.address}}</label>
                                        </td>
                                        
                                        <td>
                                            <label>邮编：</label>
                                            <label>{{context.vendor.postcode}}</label>
                                        </td>
                                    </tr>
                                    
                                </tbody>
                            </table>

                            <table class="table">
                             
                                <tbody>
                                    <tr>
                                        
                                        <td>
                                            <label>公司编码：</label>
                                            <label>{{context.vendor.id}}</label>
                                        </td>
                                        
                                        <td>
                                            <label>工厂：</label>
                                            <label>{{context.stock.name}}</label>
                                        </td>
                                    </tr>
                                    
                                </tbody>
                            </table>

                          </section>
                    </div><!-- /content-panel -->
                </div>
                </div>
                </div><!-- /col-md-12 -->
                </div><!-- /row -->
            </div>
  
          </section>
        </section><!-- /MAIN CONTENT -->
  
        <!--main content end-->
        <!--footer start-->
        <footer class="site-footer">
            <div class="text-center">
                2014 - Alvarez.is
                <a href="basic_table.html#" class="go-top">
                    <i class="fa fa-angle-up"></i>
                </a>
            </div>
        </footer>
        <!--footer end-->
    </section>

        {% comment %} <textarea id="item_result"></textarea> {% endcomment %}

        <script>
            //库存类型下拉框 此处搬了plant的
        //就四个，上次没写

        //提交
        $('#material3').on('submit', function(e) {
            e.preventDefault();
            $.ajax(
            {
                type: "POST",
                url: "{% url 'MM:ajax_create_receipt' %}",
                data:{
                    dataType: "json",
                    csrfmiddlewaretoken: '{{ csrf_token }}',
                    //$("#id").html() 这样取label内的值
                    po_id: $("#po_id").html(),
                    oi_id: $("#oi_id").html(),
                    actualQnty: $("#actualQnty").val(),
                    sType: $("#sType").val(),
                    postTime:  $("#my-input").val(), //过帐
                    time:  $("#my-input2").val(),// 收货
                    qualityScore: $("#startP").val(),
                    serviceScore: $("#startP2").val(),
                    //两个评分的id是startP、startP2；两个日期的id是my-input、my-input2；
                },
                success: function(data) {
                    $('#item_result').text(data);
                    var dataObj = eval("("+data+")");
                    if(dataObj.status==1){
                        showMessage({text: dataObj.message ,type: 'success'});
                    }else{
                        showMessage({text: dataObj.message ,type: 'error'});
                    }
                },
                failure: function() {

                }
            })
        });
        </script>


        <!-- 确认提示 -->
        <script>
            function tip(){
                if(confirm("您确认修改吗？")){
                return true;
                }
                else{
                return false;
                }
            } 
        </script>

        

    </body>
</html>